<!DOCTYPE html>
<html>
<head>
    <title>历史数据统计定时任务管理</title>
    <link href="../../system/cron/cron/themes/bootstrap/easyui.min.css" rel="stylesheet" type="text/css" />
    <link href="../../system/cron/cron/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../../system/cron/cron/icon.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <style type="text/css">
        html,body{
            width:100%;
            height:100%;
            margin:0;
            overflow: auto;
        }
        .line
        {
            height: 30px;
            line-height: 25px;
            margin: 3px;
        }
        .imp
        {
            padding-left: 25px;
        }
        .col
        {
            width: 80px;
        }
        ul {
            list-style:none;
            padding-left:10px;
        }
        li {
            height:20px;
        }
        .tools{
            /* position: absolute;
            bottom: 0px;
            box-sizing: border-box;
            padding-left:20px; */
        }
        .easyui-tabs{
            padding:0px 30px 10px 0;
        }
        .tabs-title{
            font-size: 14px;
        }
        .tabs li a.tabs-inner{
            padding:0 20px;
        }
        .imp input{
            margin-left:10px;
        }
        .layui-card .layui-form{
            padding-bottom: 0;
        }
        .layui-card-body{
            /* margin-top:-20px; */
            height:calc(100% - 100px);
        }
        .layui-fluid,.layui-card{
            height:100%
        }
        .tabs-wrap{
            padding-top: 10px;
            padding-left: 10px;
        }
        .panel-noscroll {
            /* padding-bottom: 100px; */
            position: relative;
            overflow: auto;

        }

        .layui-card-body{
            overflow: auto;
        }
        .layout {
            overflow: auto;
        }

        .tabs {
            /* background-color: ; */
            border-bottom:1px solid rgba(32,152,231,.3);
        }
        .easyui-tabs .panel-body, .tabs-header, .tabs-tool{
            background-color: #01245D;
        }

        .tabs .tabs-title {
            color: #0AA1D9
        }

        .panel-body {
            color: #347CBF
        }

        .tools {
            color: #74BCFF;
            line-height: 30px;
        }
        .tools input {
            margin-left: 10px;
            height: 35px;
        }

        .spinner-arrow {
            background-color: transparent;
        }


        .easyui-tabs .tabs li.tabs-selected a.tabs-inner{
            position: relative;
            border: none;
            background:  #01245D;
            color: #DEF5FF;
        }
        .easyui-tabs .tabs li.tabs-selected a.tabs-inner  .tabs-title{
            border: none;
            background:  #01245D;
            color: #DEF5FF;
        }

        .easyui-tabs .tabs li.tabs-selected a.tabs-inner::before {
            content: "";
            position: absolute;
            bottom: 0;
            width: 20px;
            left: 50%;
            transform: translate(-50%,0);
            border: none;
            border-radius: 0;
            border-bottom: 2px solid #3B9fff;
        }
    </style>
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layui-clear layuiadmin-card-header-auto" id="header">
            <!-- 页面路径 -->
            <span class="layui-breadcrumb">
				  <a href="">历史数据</a>
				  <a><cite>历史数据统计频率管理</cite></a>
				</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-inline layui-form ">
                <label class="layui-form-label" style="width:60px;"><span>任务类型</span></label>
                <div class="layui-input-inline">
                    <select name="type" id="type"  class="type" lay-filter="type">
                    </select>
                </div>
            </div>
            <div class="easyui-layout" style="margin:10px;
					border-radius: 5px;">
                <div style="height: 100%;overflow-x: hidden;">
                    <div class="easyui-tabs" data-options="fit:true,border:false" style="height: 500px !important;">
                        <div title="秒">
                            <div class="line">
                                <input type="radio" checked="checked" name="second" onclick="everyTime(this)">
                                每秒 允许的通配符[, - * /]</div>
                            <div class="line">
                                <input type="radio" name="second" onclick="cycle(this)">
                                周期从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:58" value="1"
                                       id="secondStart_0">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:59" value="2"
                                       id="secondEnd_0">
                                秒</div>
                            <div class="line">
                                <input type="radio" name="second" onclick="startOn(this)">
                                从
                                <input class="numberspinner" style="width: 60px;" data-options="min:0,max:59" value="0"
                                       id="secondStart_1">
                                秒开始,每
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:59" value="1"
                                       id="secondEnd_1">
                                秒执行一次</div>
                            <div class="line">
                                <input type="radio" name="second" id="sencond_appoint">
                                指定</div>
                            <div class="imp secondList">
                                <input type="checkbox" value="0">00
                                <input type="checkbox" value="1">01
                                <input type="checkbox" value="2">02
                                <input type="checkbox" value="3">03
                                <input type="checkbox" value="4">04
                                <input type="checkbox" value="5">05
                                <input type="checkbox" value="6">06
                                <input type="checkbox" value="7">07
                                <input type="checkbox" value="8">08
                                <input type="checkbox" value="9">09
                            </div>
                            <div class="imp secondList">
                                <input type="checkbox" value="10">10
                                <input type="checkbox" value="11">11
                                <input type="checkbox" value="12">12
                                <input type="checkbox" value="13">13
                                <input type="checkbox" value="14">14
                                <input type="checkbox" value="15">15
                                <input type="checkbox" value="16">16
                                <input type="checkbox" value="17">17
                                <input type="checkbox" value="18">18
                                <input type="checkbox" value="19">19
                            </div>
                            <div class="imp secondList">
                                <input type="checkbox" value="20">20
                                <input type="checkbox" value="21">21
                                <input type="checkbox" value="22">22
                                <input type="checkbox" value="23">23
                                <input type="checkbox" value="24">24
                                <input type="checkbox" value="25">25
                                <input type="checkbox" value="26">26
                                <input type="checkbox" value="27">27
                                <input type="checkbox" value="28">28
                                <input type="checkbox" value="29">29
                            </div>
                            <div class="imp secondList">
                                <input type="checkbox" value="30">30
                                <input type="checkbox" value="31">31
                                <input type="checkbox" value="32">32
                                <input type="checkbox" value="33">33
                                <input type="checkbox" value="34">34
                                <input type="checkbox" value="35">35
                                <input type="checkbox" value="36">36
                                <input type="checkbox" value="37">37
                                <input type="checkbox" value="38">38
                                <input type="checkbox" value="39">39
                            </div>
                            <div class="imp secondList">
                                <input type="checkbox" value="40">40
                                <input type="checkbox" value="41">41
                                <input type="checkbox" value="42">42
                                <input type="checkbox" value="43">43
                                <input type="checkbox" value="44">44
                                <input type="checkbox" value="45">45
                                <input type="checkbox" value="46">46
                                <input type="checkbox" value="47">47
                                <input type="checkbox" value="48">48
                                <input type="checkbox" value="49">49
                            </div>
                            <div class="imp secondList">
                                <input type="checkbox" value="50">50
                                <input type="checkbox" value="51">51
                                <input type="checkbox" value="52">52
                                <input type="checkbox" value="53">53
                                <input type="checkbox" value="54">54
                                <input type="checkbox" value="55">55
                                <input type="checkbox" value="56">56
                                <input type="checkbox" value="57">57
                                <input type="checkbox" value="58">58
                                <input type="checkbox" value="59">59
                            </div>
                        </div>
                        <div title="分钟">
                            <div class="line">
                                <input type="radio" checked="checked" name="min" onclick="everyTime(this)">
                                分钟 允许的通配符[, - * /]</div>
                            <div class="line">
                                <input type="radio" name="min" onclick="cycle(this)">
                                周期从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:58" value="1"
                                       id="minStart_0">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:59" value="2"
                                       id="minEnd_0">
                                分钟</div>
                            <div class="line">
                                <input type="radio" name="min" onclick="startOn(this)">
                                从
                                <input class="numberspinner" style="width: 60px;" data-options="min:0,max:59" value="0"
                                       id="minStart_1">
                                分钟开始,每
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:59" value="1"
                                       id="minEnd_1">
                                分钟执行一次</div>
                            <div class="line">
                                <input type="radio" name="min" id="min_appoint">
                                指定</div>
                            <div class="imp minList">
                                <input type="checkbox" value="0">00
                                <input type="checkbox" value="1">01
                                <input type="checkbox" value="2">02
                                <input type="checkbox" value="3">03
                                <input type="checkbox" value="4">04
                                <input type="checkbox" value="5">05
                                <input type="checkbox" value="6">06
                                <input type="checkbox" value="7">07
                                <input type="checkbox" value="8">08
                                <input type="checkbox" value="9">09
                            </div>
                            <div class="imp minList">
                                <input type="checkbox" value="10">10
                                <input type="checkbox" value="11">11
                                <input type="checkbox" value="12">12
                                <input type="checkbox" value="13">13
                                <input type="checkbox" value="14">14
                                <input type="checkbox" value="15">15
                                <input type="checkbox" value="16">16
                                <input type="checkbox" value="17">17
                                <input type="checkbox" value="18">18
                                <input type="checkbox" value="19">19
                            </div>
                            <div class="imp minList">
                                <input type="checkbox" value="20">20
                                <input type="checkbox" value="21">21
                                <input type="checkbox" value="22">22
                                <input type="checkbox" value="23">23
                                <input type="checkbox" value="24">24
                                <input type="checkbox" value="25">25
                                <input type="checkbox" value="26">26
                                <input type="checkbox" value="27">27
                                <input type="checkbox" value="28">28
                                <input type="checkbox" value="29">29
                            </div>
                            <div class="imp minList">
                                <input type="checkbox" value="30">30
                                <input type="checkbox" value="31">31
                                <input type="checkbox" value="32">32
                                <input type="checkbox" value="33">33
                                <input type="checkbox" value="34">34
                                <input type="checkbox" value="35">35
                                <input type="checkbox" value="36">36
                                <input type="checkbox" value="37">37
                                <input type="checkbox" value="38">38
                                <input type="checkbox" value="39">39
                            </div>
                            <div class="imp minList">
                                <input type="checkbox" value="40">40
                                <input type="checkbox" value="41">41
                                <input type="checkbox" value="42">42
                                <input type="checkbox" value="43">43
                                <input type="checkbox" value="44">44
                                <input type="checkbox" value="45">45
                                <input type="checkbox" value="46">46
                                <input type="checkbox" value="47">47
                                <input type="checkbox" value="48">48
                                <input type="checkbox" value="49">49
                            </div>
                            <div class="imp minList">
                                <input type="checkbox" value="50">50
                                <input type="checkbox" value="51">51
                                <input type="checkbox" value="52">52
                                <input type="checkbox" value="53">53
                                <input type="checkbox" value="54">54
                                <input type="checkbox" value="55">55
                                <input type="checkbox" value="56">56
                                <input type="checkbox" value="57">57
                                <input type="checkbox" value="58">58
                                <input type="checkbox" value="59">59
                            </div>
                        </div>
                        <div title="小时">
                            <div class="line">
                                <input type="radio" checked="checked" name="hour" onclick="everyTime(this)">
                                小时 允许的通配符[, - * /]</div>
                            <div class="line">
                                <input type="radio" name="hour" onclick="cycle(this)">
                                周期从
                                <input class="numberspinner" style="width: 60px;" data-options="min:0,max:23" value="0"
                                       id="hourStart_0">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:23" value="2"
                                       id="hourEnd_0">
                                小时</div>
                            <div class="line">
                                <input type="radio" name="hour" onclick="startOn(this)">
                                从
                                <input class="numberspinner" style="width: 60px;" data-options="min:0,max:23" value="0"
                                       id="hourStart_1">
                                小时开始,每
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:23" value="1"
                                       id="hourEnd_1">
                                小时执行一次</div>
                            <div class="line">
                                <input type="radio" name="hour" id="hour_appoint">
                                指定</div>
                            <div class="line" style="padding-left:24px;">AM:</div>
                            <div class="imp hourList">
                                <input type="checkbox" value="0">00
                                <input type="checkbox" value="1">01
                                <input type="checkbox" value="2">02
                                <input type="checkbox" value="3">03
                                <input type="checkbox" value="4">04
                                <input type="checkbox" value="5">05
                                <input type="checkbox" value="6">06
                                <input type="checkbox" value="7">07
                                <input type="checkbox" value="8">08
                                <input type="checkbox" value="9">09
                            </div>
                            <div class="imp hourList">
                                <input type="checkbox" value="10">10
                                <input type="checkbox" value="11">11
                            </div>
                            <div class="line" style="padding-left:24px;">PM:</div>
                            <div class="imp hourList">
                                <input type="checkbox" value="12">12
                                <input type="checkbox" value="13">13
                                <input type="checkbox" value="14">14
                                <input type="checkbox" value="15">15
                                <input type="checkbox" value="16">16
                                <input type="checkbox" value="17">17
                                <input type="checkbox" value="18">18
                                <input type="checkbox" value="19">19
                                <input type="checkbox" value="20">20
                                <input type="checkbox" value="21">21
                            </div>
                            <div class="imp hourList">
                                <input type="checkbox" value="22">22
                                <input type="checkbox" value="23">23
                            </div>
                        </div>
                        <div title="日">
                            <div class="line">
                                <input type="radio" checked="checked" name="day" onclick="everyTime(this)">
                                日 允许的通配符[, - * / L W]</div>
                            <div class="line">
                                <input type="radio" name="day" onclick="unAppoint(this)">
                                不指定</div>
                            <div class="line">
                                <input type="radio" name="day" onclick="cycle(this)">
                                周期从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:31" value="1"
                                       id="dayStart_0">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:31" value="2"
                                       id="dayEnd_0">
                                日</div>
                            <div class="line">
                                <input type="radio" name="day" onclick="startOn(this)">
                                从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:31" value="1"
                                       id="dayStart_1">
                                日开始,每
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:31" value="1"
                                       id="dayEnd_1">
                                天执行一次</div>
                            <div class="line">
                                <input type="radio" name="day" onclick="workDay(this)">
                                每月
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:31" value="1"
                                       id="dayStart_2">
                                号最近的那个工作日</div>
                            <div class="line">
                                <input type="radio" name="day" onclick="lastDay(this)">
                                本月最后一天</div>
                            <div class="line">
                                <input type="radio" name="day" id="day_appoint">
                                指定</div>
                            <div class="imp dayList">
                                <input type="checkbox" value="1">01
                                <input type="checkbox" value="2">02
                                <input type="checkbox" value="3">03
                                <input type="checkbox" value="4">04
                                <input type="checkbox" value="5">05
                                <input type="checkbox" value="6">06
                                <input type="checkbox" value="7">07
                                <input type="checkbox" value="8">08
                                <input type="checkbox" value="9">09
                                <input type="checkbox" value="10">10
                            </div>
                            <div class="imp dayList">
                                <input type="checkbox" value="11">11
                                <input type="checkbox" value="12">12
                                <input type="checkbox" value="13">13
                                <input type="checkbox" value="14">14
                                <input type="checkbox" value="15">15
                                <input type="checkbox" value="16">16
                                <input type="checkbox" value="17">17
                                <input type="checkbox" value="18">18
                                <input type="checkbox" value="19">19
                                <input type="checkbox" value="20">20
                            </div>
                            <div class="imp dayList">
                                <input type="checkbox" value="21">21
                                <input type="checkbox" value="22">22
                                <input type="checkbox" value="23">23
                                <input type="checkbox" value="24">24
                                <input type="checkbox" value="25">25
                                <input type="checkbox" value="26">26
                                <input type="checkbox" value="27">27
                                <input type="checkbox" value="28">28
                                <input type="checkbox" value="29">29
                                <input type="checkbox" value="30">30
                            </div>
                            <div class="imp dayList">
                                <input type="checkbox" value="31">31
                            </div>
                        </div>
                        <div title="月">
                            <div class="line">
                                <input type="radio" checked="checked" name="mouth" onclick="everyTime(this)">
                                月 允许的通配符[, - * /]</div>
                            <!--       <div class="line">
                                       <input type="radio" name="mouth" onclick="unAppoint(this)">
                                       不指定</div> -->
                            <div class="line">
                                <input type="radio" name="mouth" onclick="cycle(this)">
                                周期从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:12" value="1"
                                       id="mouthStart_0">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:12" value="2"
                                       id="mouthEnd_0">
                                月</div>
                            <div class="line">
                                <input type="radio" name="mouth" onclick="startOn(this)">
                                从
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:12" value="1"
                                       id="mouthStart_1">
                                日开始,每
                                <input class="numberspinner" style="width: 60px;" data-options="min:1,max:12" value="1"
                                       id="mouthEnd_1">
                                月执行一次</div>
                            <div class="line">
                                <input type="radio" name="mouth" id="mouth_appoint">
                                指定</div>
                            <div class="imp mouthList">
                                <input type="checkbox" value="1">01
                                <input type="checkbox" value="2">02
                                <input type="checkbox" value="3">03
                                <input type="checkbox" value="4">04
                                <input type="checkbox" value="5">05
                                <input type="checkbox" value="6">06
                                <input type="checkbox" value="7">07
                                <input type="checkbox" value="8">08
                                <input type="checkbox" value="9">09
                                <input type="checkbox" value="10">10
                            </div>
                            <div class="imp mouthList">
                                <input type="checkbox" value="11">11
                                <input type="checkbox" value="12">12
                            </div>
                        </div>
                        <div title="周">
                            <div class="line">
                                <input type="radio" checked="checked" name="week" onclick="everyTime(this)">
                                周 允许的通配符[, - * / L #]</div>
                            <div class="line">
                                <input type="radio" name="week" onclick="unAppoint(this)">
                                不指定</div>
                            <div class="line">
                                <input type="radio" name="week" onclick="startOn(this)">
                                周期 从星期<input class="numberspinner" style="width: 60px;" data-options="min:1,max:7"
                                             id="weekStart_0" value="1">
                                -
                                <input class="numberspinner" style="width: 60px;" data-options="min:2,max:7" value="2"
                                       id="weekEnd_0"></div>
                            <div class="line">
                                <input type="radio" name="week" onclick="weekOfDay(this)">
                                第<input class="numberspinner" style="width: 60px;" data-options="min:1,max:4" value="1"
                                        id="weekStart_1">
                                周 的星期<input class="numberspinner" style="width: 60px;" data-options="min:1,max:7"
                                            id="weekEnd_1" value="1"></div>
                            <div class="line">
                                <input type="radio" name="week" onclick="lastWeek(this)">
                                本月最后一个星期<input class="numberspinner" style="width: 60px;" data-options="min:1,max:7"
                                               id="weekStart_2" value="1"></div>
                            <div class="line">
                                <input type="radio" name="week" id="week_appoint">
                                指定</div>
                            <div class="imp weekList">
                                <input type="checkbox" value="1">1
                                <input type="checkbox" value="2">2
                                <input type="checkbox" value="3">3
                                <input type="checkbox" value="4">4
                                <input type="checkbox" value="5">5
                                <input type="checkbox" value="6">6
                                <input type="checkbox" value="7">7
                            </div>
                        </div>
                        <div title="年">
                            <div class="line">
                                <input type="radio" checked="checked" name="year" onclick="unAppoint(this)">
                                不指定 允许的通配符[, - * /] 非必填</div>
                            <div class="line">
                                <input type="radio" name="year" onclick="everyTime(this)">
                                每年</div>
                            <div class="line">
                                <input type="radio" name="year" onclick="cycle(this)">周期 从
                                <input class="numberspinner"  style="width: 90px;" data-options="min:2013,max:3000"
                                       id="yearStart_0" >
                                -
                                <input class="numberspinner"  style="width: 90px;" data-options="min:2014,max:3000"
                                       id="yearEnd_0" ></div>
                        </div>
                    </div>
                    <div class="tools">
                        时间表达式:<input type="text" name="cron" style="width: 200px" value="* * * * * ?" id="cron" disabled
                        />
                        <div style="margin:20px 100px 0 0">
                            <div class='layui-btn edit' lay-submit lay-filter="save" data-name='save' id="save">保存</div>
                            <div class='layui-btn layui-btn-danger' lay-submit lay-filter="pause" data-name='pause' style="display: none;" id="pause">任务暂停</div>
                            <div class='layui-btn layui-btn-normal' lay-submit lay-filter="resume" data-name='resume' style="display: none;" id="resume">任务开始</div>
                        </div>
                    </div>
                </div>
                <div data-options="region:'south',border:false" style="height:150px;display: none;">
                    <fieldset style="border-radius: 3px; height: 120px;">
                        <legend>时间表达式</legend>
                        <table style="height: 100px;">
                            <tbody>
                            <tr>
                                <td>
                                </td>
                                <td align="center">
                                    秒
                                </td>
                                <td align="center">
                                    分钟
                                </td>
                                <td align="center">
                                    小时
                                </td>
                                <td align="center">
                                    日
                                </td>
                                <td align="center">
                                    月<br />
                                </td>
                                <td align="center">
                                    星期
                                </td>
                                <td align="center">
                                    年
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    表达式字段:
                                </td>
                                <td>
                                    <input type="text" name="v_second" class="col" value="*" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_min" class="col" value="*" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_hour" class="col" value="*" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_day" class="col" value="*" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_mouth" class="col" value="*" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_week" class="col" value="?" readonly="readonly" />
                                </td>
                                <td>
                                    <input type="text" name="v_year" class="col" readonly="readonly" />
                                </td>
                            </tr>
                            <tr >
                                <td>Cron 表达式:</td>
                                <td colspan="6"></td>
                                <td><input type="button" value="反解析到UI " id="btnFan" onclick="btnFan()"/></td>
                            </tr>
                            <tr style="text-align: right;">

                            </tr>
                            </tbody>
                        </table>
                    </fieldset>
                    <div style="text-align: center; margin-top: 5px;">
                        <script type="text/javascript">


                        </script>
                        <div>
                        </div>
                    </div>
                </div>
                <div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../../system/cron/cron/jquery.min.js" type="text/javascript"></script>
<script src="../../system/cron/cron/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script src="../../../layuiadmin/utils/date.js"></script>
<script>
    layui.config({
        base: '../../../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'table','form','laydate','common'], function() {
        var $ = layui.$
            ,form = layui.form
            ,table = layui.table
            ,laydate = layui.laydate;
        // layui.setter.baseUrl + /
        var response = layui.setter.response;
        var baseUrl = layui.setter.baseUrl+'history-admin/scheduler/'; // 配置rest请求路径。如'auth/account/'
        var viewPath = 'history/cronTask/';  // 前台html页面在view目录下的路径
        // 当前选择的任务类型 全局变量
        let currentCronTaskType;
        // 获取定时任务类型
        getTaskType().then(function(res){
            if(res[response.statusName]==0&&res[response.dataName]){
                var typeHtml="";
                for(key in res[response.dataName]){
                    var sel="";
                    if(!typeHtml){
                        sel="selected";
                        getDronInfo(key);
                    }
                    typeHtml+=`<option value='${key}' ${sel}>${res[response.dataName][key]}</option>`
                }
                $("#type").html(typeHtml);
                form.render();
                form.on('select(type)', function(data){
                    //_self.active=data.value;
                    getDronInfo(data.value)
                });
            }
        });

        $("#save").on("click",function(){
            var cron=$("#cron").val();
            if(!cron){
                layer.msg("请先选择时间表达式再进行保存", {
                    icon: '5'
                });
                return
            }
            var type=$("#type").val();
            POST(baseUrl+"save", {cron:cron,type:type}).then((res) => {
                if (res[response.statusName] === 0) {
                    layer.msg("保存成功", {
                        icon: 1,
                        time: 500
                    }, function () {
                        getDronInfo($("#type").val());
                    });
                } else {
                    layer.msg("保存失败", {
                        icon: 2,
                        time: 500
                    }, function () {
                        //parent.layer.closeAll();
                        //	window.parent.location.reload();
                    });
                }
            });
        });
        $("#pause").on("click",function(){
            pause();
        });
        $("#resume").on("click",function(){
            resume();
        });
        //暂停
        function pause(){
            GET(baseUrl + `pause`, {type: currentCronTaskType}).then((res) => {
                var message="任务暂停";
                message+=res.result===true?"成功":"失败";
                layer.msg(message, {
                    icon: 1,
                    time: 1000
                }, function () {
                    if(res.result){
                        $("#resume").show();
                        $("#pause").hide();
                    }
                });
            });
        }
        //重新开始
        function resume(){
            GET(baseUrl + `resume`, {type: currentCronTaskType}).then((res) => {
                var message="任务开始";
                message+=res.result===true?"成功":"失败";
                layer.msg(message, {
                    icon: 1,
                    time: 1000
                }, function () {
                    if(res.result){
                        $("#resume").hide();
                        $("#pause").show();
                    }
                });
            });
        }

        //获取任务信息
        function getDronInfo(task_type){
            // 赋值当前选择的任务类型
            currentCronTaskType = task_type;
            GET(baseUrl,{type:task_type}).then(function(res){
                if(res[response.statusName]==0&&res[response.dataName]){
                    $("#cron").val(res[response.dataName].cronExpression);
                    $("#btnFan").click();
                    if(res[response.dataName].jobStatus=="NORMAL"){
                        $("#resume").hide();
                        $("#pause").show();
                    }else{
                        $("#pause").hide();
                        $("#resume").show();
                    }
                } else {
                    // 返回数据无指定条件时，皆隐藏数据
                    $("#resume").hide();
                    $("#pause").hide();
                }
            });
        }

        //获取任务类型
        function getTaskType(){
            var _d=GET(baseUrl+"types",{});
            return _d;
        }
    });

    let year=new Date().getFullYear();
    //$("#yearStart_0").attr("data-options",`min:${year},max:3000`).val(year);
    //$("#yearEnd_0").attr("data-options",`min:${year+1},max:3000`).val(year+1);

    $("#yearStart_0").numberspinner({
        min:year,
        value:year,
        max:3000,
        /*onChange: function(newValue,oldValue){
            var startYear=newValue;
            var endYear=$("#yearEnd_0").val();
            console.log(startYear);
            if(startYear>=endYear){
                $("#yearEnd_0").val(startYear+1);
            }
        }*/
    });
    $("#yearEnd_0").numberspinner({
        min:year+1,
        value:year+1,
        max:3000,
    })
    /* 		let getParams = function() {
                let queryStr = decodeURI(window.location.search.slice(1));
                let paramsArr = queryStr.split('&');
                let params = {};

                // 获取url拼接参数
                paramsArr.forEach((item, index) => {
                    params[item.split('=')[0]] = item.split('=')[1];
                })
                if(!params.pageName) {
                    params.pageName = window.localStorage.getItem('pageName')
                }

                // 获取页面跳转传递参数{a:0, b:1}
                if(localStorage.getItem('ROUTE_PARAMS') !=null && localStorage.getItem('ROUTE_PARAMS') != undefined){
                    var data = JSON.parse(localStorage.getItem('ROUTE_PARAMS'));
                    for(var key in data){
                        params[key] = data[key];
                    }
                }
                localStorage.removeItem('ROUTE_PARAMS');

                return params;
            }
            let params=getParams();

            $(function(){
                $("#cron").val(params.cron);
                $("#btnFan").click();
            }); */

</script>


</body>
</html>
